import type { TypeUserInfo } from '@/stores/types';
import type { RankedInfo } from '@/types/ranked'
import { req, reqRoit } from './request'

// 获取当前用户信息
export const getMyInfo = () => req('/lol-summoner/v1/current-summoner')

// 获取指定玩家别名信息（用于根据名字查资料）
export const getPlayerAccountAlias = (params) => reqRoit(`/player-account/aliases/v1/lookup`, params)

// 获取指定玩家信息
export const getPlayerInfoApi = (puuid): Promise<TypeUserInfo> => req(`/lol-summoner/v2/summoners/puuid/${puuid}`)

// 获取当前是否搜索对局状态
export const getSearchStatusApi = () => req('/lol-lobby/v2/lobby/matchmaking/search-state')

// 功能：接受对局
export const acceptGameApi = () => req('/lol-matchmaking/v1/ready-check/accept', null, 'POST')

// 获取段位
export const getRankedStatsApi = (puuid): Promise<RankedInfo> => req(`/lol-ranked/v1/ranked-stats/${puuid}`)

// 根据用户名获取玩家信息
export const getPlayerInfoByNameApi = (data) => req(`/lol-summoner/v2/summoners/names`, data, 'POST')
